package com.men.tools;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {

	public static String getCurDate_yyyyMMdd(){
		return getDateFormat(getCurDate(),"yyyyMMdd");
	}
	public static String getDateFormat(Date date,String format){
		DateFormat df = new SimpleDateFormat(format);
		return df.format(date);
	}
	public static Date getCurDate(){
		return new Date();
	}
	public static Date getDateFromMills(long millsecons){
		return new Date(millsecons);
	}
	public static Date parseDate(String dateStr, String format) throws ParseException {
		DateFormat df = new SimpleDateFormat(format);
		return df.parse(dateStr);
	}
	public static int getWeekOfDate() {
        Calendar cal = Calendar.getInstance();
        int w = cal.get(Calendar.DAY_OF_WEEK)-1 ;
        if (w <= 0)
            w = 7;
        return w;
    }
}
